
import { resetRouter, constantRoutes } from '@/router'

const getDefaultState = () => {
  return {
    routes: constantRoutes
  }
}

const state = getDefaultState()

const mutations = {
  RESET_STATE: (state) => {
    Object.assign(state, getDefaultState())
  }
}

const actions = {

  // user logout
  logout({ commit, dispatch }) {
    resetRouter()
    dispatch('tagsView/delAllViews', null, { root: true })
    commit('RESET_STATE')
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

